using SS;
using System;
using System.Data.SqlClient;
namespace TVSGPP.core
{
	internal class clsPrice
	{
		private Func objFunc = new Func();
		public float getPriceOutput(float inputPrice, string percent_n)
		{
			float result = 0f;
			try
			{
				SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
				sqlConnection.Open();
				SqlCommand sqlCommand = new SqlCommand(string.Concat(new object[]
				{
					"SELECT ",
					percent_n,
					" FROM [tabPriceBase] WHERE ",
					inputPrice,
					" >= [level1] AND ",
					inputPrice,
					" <= [Level2]"
				}), sqlConnection);
				SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
				while (sqlDataReader.Read())
				{
					result = float.Parse(sqlDataReader[percent_n].ToString());
				}
				sqlDataReader.Close();
				sqlConnection.Close();
				sqlConnection.Dispose();
			}
			catch
			{
			}
			return result;
		}
	}
}
